import React, { useState, createContext, useEffect } from 'react'
import { getlist } from '../api/data'
import Child1 from './child-One'
export const SetCreateContext = createContext(null)
export default function App() {
    const [Data, setData] = useState([])
    const { Provider } = SetCreateContext

    useEffect(() => {
        getlist().then(res => {
            if (res) {
                setData(res)
            }
        })
    }, [])

    return (

        <div>
            <Provider value={Data}>
                <Child1 Data={Data} />
            </Provider>
            {/* {
              Data.map((item,index)=>{
              return <div>{item}</div>
              })
          } */}

        </div>
    )
}

